<?php
class Customer_Model_Balance
{

	private $_table;
	//Initalizing Db Table  
	public function __construct(){
		$this->_table = new Customer_Model_DbTable_Balance();
	}
	
	
	/**
	*Create A Record  
	*@param rowSet $row 
	*@return boolean
	*/
	public  function add($row){	 
 		return $this->_table->insert($row); 
	}
	
	/**
	*Update One Row  
	*@param rowSet $row 
	*@param int $cb_id 
	*@return boolean
	*/
	public  function update($row,$id){
		$row['cb_last_update'] =  date("Y-m-d H:i:s");
		$where = $this->_table->getAdapter()->quoteInto('cb_id = ?', $id);
		return $this->_table->update($row, $where);	
	}
		
	/**
	*No Delete One Row
	*@param int $cb_id 
	*@return boolean
	*/
	 public function delete($id){	
		$where = $this->_table->getAdapter()->quoteInto('cb_id = ?', $id); 
		return $this->_table->delete($where);		
	}
	
	/**
	*Get Rowset By user 
	*@param string $customer_id
	*@return Rowset
	*/
	public function getByCustomerId($id){
		$select = $this->_table->select()->where('customer_id = ?', $id);	 
		return $this->_table->fetchRow($select);
	}
	
	public function updateCustomerId($row,$customer_id){
		$where = $this->_table->getAdapter()->quoteInto('customer_id = ?', $id);
		return $this->_table->update($row, $where);	
	}
	
	
}